﻿
Imports System.Runtime.CompilerServices
Imports std

Public Module extensions
    <Extension()> Public Function find(Of T As IComparable(Of T), T2) _
                                      (ByVal m As map(Of T, T2), ByVal ParamArray ss() As T) As map(Of T, T2).iterator
        If m Is Nothing Then
            Return Nothing
        ElseIf ss Is Nothing OrElse ss.Length() = 0 Then
            Return m.end()
        Else
            For i As Int64 = 0 To ss.Length() - 1
                Dim it As map(Of T, T2).iterator = Nothing
                it = m.find(ss(i))
                If it <> m.end() Then
                    Return it
                End If
            Next

            Return m.end()
        End If
    End Function
End Module
